All Questions
30 questions
0votes
3answers
245views
Handling Space in Filename for sed command
I have 3 files: en.json, en 1.json and en 2.json. All of them have the below content { "ABC" : "/long_name", "DFG" : "/{long_name}" } I run ...
-1votes
1answer
2kviews
Find how many words in a file contain a number in them?
I am trying to find the total number of words in a specific file that contain a number. Not a specific number, I'm just looking for words that contain any number at all. I tried using the grep and ...
0votes
1answer
192views
How to zgrep and then gzip multiple files individually?
I have the following code which searches for a term in multiple files (file1.json.gz, file2.json.gz, etc etc) using zgrep, and then using gzip it saves the output into a single file: zgrep -i 'help' /...
15votes
2answers
3kviews
Is there a problem with grep command? I am getting characters that don't match my regular expression
I ran this command: grep -i 'bro*' shows.csv and got this as output 1845307,2 Broke Girls,2011,138,6.7,89093 1702042,An Idiot Abroad,2010,21,8.3,29759 903747,Breaking Bad,2008,62,9.5,1402577 2249364,...
-2votes
1answer
64views
Remove all URLs in a series with the same domain except the last occurrence, in a long list of many URL series
I have a problem that I think sed is probably perfect for, but I don't know enough about it to figure out how to employ it correctly. Here's what I have - a file like this, but much longer: https://...
0votes
3answers
61views
Changing content format [duplicate]
I have a text file which has 1000 rows/entries. These 1000 entries correspond to the column names for my dataframe. These are the new features that need to be added to the dataframe for model ...
0votes
2answers
400views
grep for lines not after a pattern
I'm trying to find all lines of a file not being after a specific pattern. For some time I had an issue with my history using GNU bash (version 4 and 5) where commands appeared in duplicates. I ...
0votes
3answers
689views
ps does not support the -x flag on a particular version of linux
My ps command works except on a particular version on Linux as you can see below. [root@failinghost ~]# ps -xef | grep -v grep | grep websphere Warning: bad syntax, perhaps a bogus '-'? See /usr/share/...
-1votes
3answers
338views
Replace specific characters inside quotes
I'm trying to mask some sensitive data in a log file. I first need to filter out specific lines from the file with a matching pattern and then for those specific lines I need to replace any text ...
0votes
4answers
198views
Question about Gnu/Linux command line interface, with grep, ls, and cat
Greetings Stack Exchange, My Goal:Execute ls to search the entire directory structure and grep to search for cats.py. Use cat to read the file cats.py. I know that sounds like Gnu/Linux inception. ...
-1votes
3answers
886views
How to list all files that end in ".doc" that exist in a directory and subdirectories whose name contain a certain word WITHOUT piping? [closed]
For example, If I have a directory called Test and it has a file named test.doc and String and a subdirectory Tests with doc2.doc So the output in this case would just be test.doc because the ...
0votes
0answers
324views
Beautify the o/p of grep command
I am writing a bash script. It runs a couple of grep commands, and record the output of the grep command, in a text file. I am getting the output, but it is not formatted, so it is very difficult to ...
1vote
2answers
298views
output mixed alphanumeric input with grep,pipe and cat
I have a mixed wordlist as an input: azert12345 a1z2e3r4t5 a1z2e3r455 The command line I have tried to execute: cat file.txt | grep -E "[[:digit:]]{5}" --color What do I want to accomplish: Print ...
0votes
3answers
2kviews
Use grep to search for words beginning with non-word characters
The contents of the file testing.txt are: ls -a cmake --verbose verbose I want to use grep to look through this file and find only the word beginning with "--" i.e. the word "--verbose" However ...
1vote
1answer
114views
Search for files using terminal and open with preferred program when clicked?
I would like to somehow create links to files within the terminal from search results found when searching files. Same way you would click a hyperlink within the terminal, but in this case it would be ...